A similar member function, deque::at, has the same behavior as this operator function, except that deque::at signals if the requested position is out of range by throwing an exception.
Parameters
- n
- Position of an element in the container.
Notice that the first element has a position of 0, not 1.
Member type size_type is an unsigned integral type.
Return value
The element at the specified position in the deque container.Member types reference and const_reference are the reference types to the elements of the deque container (generally defined as T& and const T& respectively in most storage allocation models).
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
Output:
mydeque contains: 9 8 7 6 5 4 3 2 1 0 |
Complexity
Constant.See also
| deque::at | Access element (public member function) |
| deque::front | Access first element (public member function) |
| deque::back | Access last element (public member function) |
